/**
 * Created by huangxuehua on 2017/11/27.
 */
//$("header>a.goBack").click(function(){
//    window.history.go(-1)
//});
var xpHome = new Vue({
    el:'#app',
    data:{
        imgBaseUrl:nUrls.imgBaseUrl,
        goodsInfoList:[]//收藏的产品信息
    },
    methods:{
        getImage:function(url){//加载图片  处理 url为空 加载出错
            if(url){
                return xpHome.imgBaseUrl+url;
            }
        },
        getCollectInfo:function(){
            $.ajax({
                url:nUrls.getCollectGoodsInfo,
                type:"POST",
                success: function (data) {
                    var result = eval('(' + data + ')');
                    if (result && result.code == 200) {
                        xpHome. goodsInfoList=result.data
                        console.log( xpHome. goodsInfoList)
                    }
                },
                error: function () {
                    console.log("添加到收藏信息出错");
                }
            })
        },
        goGoodsDetail:function(goods_id){//首页
            window.location.href = "../detail/goods_detail.html?id="+goods_id;
        },
        goOnLine:function(){  //断网刷新
            nUtils.onLine();
        }
    }
});
$(function(){
    xpHome.getCollectInfo()
})